package com.Springexample.demo.service;

import org.springframework.beans.factory.annotation.Autowired;

public class AnotherService {

    private MyService myService;

    // 通过 Setter 方法注入
    public void setMyService(MyService myService) {
        this.myService = myService;
    }

    public void printMessage() {
        System.out.println("AnotherService is calling: " + myService.getMessage());
    }
}